package com.lufei.dh.more.Adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import com.lufei.dh.R;
import com.lufei.dh.more.Bean.BeanItem;
import com.lufei.dh.more.Bean.BeanMore;
import com.lufei.dh.view.Mult.Bean.BeanData;

import java.util.List;

/**
 * 版权：易金卡沃 版权所有
 * <p>
 * 作者：lufei
 * <p>
 * 创建日期：2018/6/25
 * <p>
 * 描述：
 * <p>
 * 修订历史：
 */
public class Adapter_more extends BaseMultiItemQuickAdapter<BeanMore, BaseViewHolder> {
    /**
     * Same as QuickAdapter#QuickAdapter(Context,int) but with
     * some initialization data.
     *
     * @param data A new list is created out of this one to avoid mutable list
     */
    private Context context;

    public Adapter_more(List<BeanMore> data, Context context) {
        super(data);
        this.context = context;
        addItemType(1, R.layout.item_category);
        addItemType(2, R.layout.item_two);
        addItemType(3, R.layout.item_song);
    }

    @Override
    protected void convert(BaseViewHolder helper, BeanMore item) {
        switch (helper.getItemViewType()) {
            case 1:
                helper.setText(R.id.title,item.getTitle());
                helper.setText(R.id.time,item.getDate());
                Glide.with(context).load(item.getThumbnail_pic_s()).into((ImageView) helper.getView(R.id.image1));
                break;
            case 2:
                helper.setText(R.id.title,item.getTitle());
                helper.setText(R.id.time,item.getDate());
                Glide.with(context).load(item.getThumbnail_pic_s()).into((ImageView) helper.getView(R.id.image1));
                Glide.with(context).load(item.getThumbnail_pic_s02()).into((ImageView) helper.getView(R.id.image2));
                break;
            case 3:
                helper.setText(R.id.title,item.getTitle());
                helper.setText(R.id.time,item.getDate());
                Glide.with(context).load(item.getThumbnail_pic_s()).into((ImageView) helper.getView(R.id.image1));
                Glide.with(context).load(item.getThumbnail_pic_s02()).into((ImageView) helper.getView(R.id.image2));
                Glide.with(context).load(item.getThumbnail_pic_s03()).into((ImageView) helper.getView(R.id.image3));
                break;
        }
    }
}
